<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>运营管理 - 景点管理 - 编辑路书</title>
<?php include(P_TEMPLATE . '/admin/header.tpl.php'); ?>
<script type="text/javascript">
$(function() {
	$('#submitBtn').click(function() {
		$.ajax({
			url: "<?php echo URL('admin/admin.addAdmin'); ?>",
			data: $('#admin_frm').serialize(),
			type: 'post',
			dataType: 'json',
			success: function(ret) {
				if (ret.rst) {
					location.href = '<?php echo URL('admin/admin.userList'); ?>';
				} else {
					Xwb.ui.MsgBox.alert('操作失败', ret.err);
				}
			}
		});
	});
});
</script>
</head>
<body class="main-body">
	<div class="path"><p>当前位置：系统管理<span>&gt;</span>后台账号管理<span>&gt;</span>添加管理账号</p></div>
    <div class="main-cont">
    	<h3 class="title">添加管理员账号</h3>
    	<div class="set-area">
            <form name="admin_frm" id="admin_frm" action="<?php echo URL('admin/admin.addAdmin'); ?>" method="post" enctype="multipart/form-data">
            	<div class="form-area">
            		<div class="form-row">
                        <label for="username" class="form-field">帐号名称</label>
                        <div class="form-cont">
                    		<input id="username" value="" class="input-txt" name="username" type="text" vrel="_f|ne|sz=max:30,m:不能超过15个字,ww" warntip="#nameTips" /><span id="nameTips" class="tips-error hidden"></span>
                		</div>
                    </div>
                    <div class="form-row">
                        <label for="pwd" class="form-field">密码</label>
                        <div class="form-cont">
                    		<input id="pwd" value="" class="input-txt" name="pwd" type="password" vrel="_f|ne|sz=max:20,m:不能超过20个字符,ww" warntip="#pwdTips" /><span id="pwdTips" class="tips-error hidden"></span>
                		</div>
                    </div>
                    <div class="form-row">
                        <label class="form-field" for="re_pwd">确认密码</label>
                        <div class="form-cont">
                            <input id="re_pwd" value="" class="input-txt" name="re_pwd" type="password" vrel="_f|ne|sz=max:20,m:不能超过20个字符,ww" warntip="#repwdTips" /><span id="repwdTips" class="tips-error hidden"></span>
                        </div>
                    </div>
                    <div class="form-row">
                        <label class="form-field" for="">账号权限</label>
                        <div class="form-cont" style="width:70%;">
                        	<p class="text">
	                            <?php foreach ($nav as $navName => $navItem): ?>
	                            <?php echo $navName, '<br />'; ?>
		                            <?php foreach ($navItem['menus'] as $menus): ?>
	                            		<?php if (count($menus['menu_qx']) > 1): ?>
	                            			<?php echo '　　', $menus['menu_name'] , '<br />'; ?>
	                            			<?php foreach ($menus['menu_list'] as $menu): ?>
	                            			<?php echo '　　　　'; ?><label for="pchk_<?php echo $menu['qx']; ?>"><input type="checkbox" name="permissions[]" id="pchk_<?php echo $menu['qx']; ?>" class="ipt-checkbox" value="<?php echo $menu['qx']; ?>"><?php echo $permissions[$menu['qx']]['name']; ?></label><br />
	                            			<?php endforeach; ?>
	                            		<?php else: ?>
	                            			<?php $sub_qx = $menus['menu_qx'][0]; ?>
	                            			<?php echo '　　'; ?><label for="pchk_<?php echo $sub_qx; ?>"><input type="checkbox" name="permissions[]" id="pchk_<?php echo $sub_qx; ?>" class="ipt-checkbox" value="<?php echo $sub_qx; ?>"><?php echo $permissions[$sub_qx]['name']; ?></label><br />
	                            		<?php endif; ?>
		                            <?php endforeach; ?>
	                            <?php endforeach; ?>
                            </p>
                        </div>
                    </div>
                    <div class="btn-area">
                        <a href="javascript:;" id="submitBtn" class="btn-general highlight" ><span>提交</span></a>
                    </div>
            	</div>
            </form>
        </div>
    </div>
</body>
</html>